from random import choice
import os

def generate_password(length,chars='abcdefghijklmnopqrstuvwxyz0123456789'):
    return ''.join([ choice(chars) for i in range(length) ]) #@UnusedVariable

def generate_secret():
    return generate_password(50,'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)')

def get_system_secret( path ):
    if not os.path.exists( path ):
        with open(path,'w') as f:
            f.write( generate_secret() )    
    with open(path) as f:
        return f.read()

def get_relative_func( file ):
    return lambda p: os.path.abspath(os.path.join(os.path.dirname(file), p))
    
